public class Apps {

    public static void main(String[] students) {
        //truyen tham so n la so luong sinh vien can nhap
        int n;
        n = Integer.parseInt(students[0]);
        if ((n < 1) || (students[0] == null)) {
            System.out.println("Nhap sai so luong sv, xin nhap lai!");
        } else {
            System.out.println("So luong sinh vien can nhap: " + n);
        }
        int i;
        Student[] sv = new Student[n];//Tao doi tuong thuoc lop Student
        for (i = 0; i < n; i++)//nhap thong tin sinh vien i
        {
            System.out.println("Nhap vao sinh vien thu " + (i + 1) + ":");
            sv[i] = new Student();
            sv[i].NhapDuLieu();
        }
        //hien thi danh sach sinh vien da nhap
        System.out.println("________________THONG TIN SINH VIEN______________");
        System.out.println("|______HO TEN______|___MSSV___|_____DIEM THI_____");
        for (i = 0; i < n; i++) {
            sv[i].HienThi();
        }
        //    hien thi sinh vien diem cao, diem thap
        double max, min;
        max = sv[0].diemthi;
        min = max;
        for (i = 0; i < n; i++) {
            if (sv[i].diemthi > max) {
                max = sv[i].diemthi;
            }
            if (sv[i].diemthi < min) {
                min = sv[i].diemthi;
            }
        }
        System.out.println("Sinh vien diem cao nhat:");
        System.out.println("------------------------");
        System.out.println("|______HO TEN______|___MSSV___|_____DIEM THI_____");
        for (i = 0; i < n; i++) {
            if (sv[i].diemthi == max) {
                sv[i].HienThi();
            }
        }
        System.out.println("Sinh vien diem thap nhat:");
        System.out.println("------------------------");
        System.out.println("|______HO TEN______|___MSSV___|_____DIEM THI_____");        
        for (i = 0; i < n; i++) {
            if (sv[i].diemthi == min) {
                sv[i].HienThi();
            }
        }
        System.out.println("Danh sach sinh vien co diem >4.0");
        System.out.println("------------------------");
        System.out.println("|______HO TEN______|___MSSV___|_____DIEM THI_____");
        for (i = 0; i < n; i++) {
            if (sv[i].diemthi >4.0) {
                sv[i].HienThi();
            }
        }
        double dtb,tong=0;
        for(i=0;i<n;i++)
        {
            tong+=sv[i].diemthi;
        }
        dtb=tong/n;
        System.out.println("Diem trung binh ca lop: "+dtb);
    }
}